#include<cmath>
#include<iostream>
#include"TF1.h"
#include"TH2F.h"
using namespace std;
void Draw(){
    TCanvas * can = new TCanvas ("can", "can", 800, 800);
	TFile * file = new TFile ("/home/xinmei/Geant4/Practice/desyMC/build_qe/result000_2_5GeV.root");//打开文件
    if (file->IsZombie()){
        cout<<"Error opening file"<<endl;
    }
    TTree * tree = (TTree*)file->Get("CerenkovPosition");//读取文件
    
    double x=0,y=0,z=0;//用于存储原root文件的坐标

    tree->SetBranchAddress("X", &x);
	tree->SetBranchAddress("Y", &y);
	tree->SetBranchAddress("Z", &z);  

    TH2F *hist = new TH2F("hits","RICH Hit Position",400,-200,200,400,-400,0);
    for(int i=0;i<tree->GetEntries();i++){
		tree->GetEntry(i);
        hist->Fill(x,y);
	}
    hist->GetXaxis()->SetTitle("mm");
    hist->GetYaxis()->SetTitle("mm");
    hist->GetYaxis()->SetTitleOffset(1.0);
    hist->Draw("colz");
    
}
